package org.hertsig;

import javax.servlet.http.HttpServlet;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.webapp.WebAppContext;
import org.hertsig.magiccardmarket.oauth.SignpostApi;

import com.google.common.base.Joiner;

public class Test {
//	Test server: https://sandbox.mkmapi.eu/
//	login: Jorn86 / mcmtestpassword
//	App name: Jorn86-Test2
//	App token: VQCZg3uuGcR1ow67
//	App secret: jodoKR7j0sBKZJ1CTBEBrlbKM9FMDZlB
//	Access token: RRJQatihqxX0HF7W13mhIqthgvCZpk5G
//	Access token secret: gTj5TcrpN5sUsBDEnVxv2A59r7nliaHo
	
	public static void main(String[] args) throws Exception {
		SignpostApi api = new SignpostApi("VQCZg3uuGcR1ow67", "jodoKR7j0sBKZJ1CTBEBrlbKM9FMDZlB", 
				"RRJQatihqxX0HF7W13mhIqthgvCZpk5G", "gTj5TcrpN5sUsBDEnVxv2A59r7nliaHo");
		Joiner.on('\n').appendTo(System.out, api.getMarketplaceApi().games());
		Joiner.on('\n').appendTo(System.out, api.getWantsListApi().wantsLists());
	}
	
	private static Server startServer(HttpServlet callbackServlet) throws Exception {
		Server server = new Server(8080);
		WebAppContext context = new WebAppContext("./", "/");
		context.setServer(server);
		
		context.addServlet(new ServletHolder(callbackServlet), "/");
		
		ContextHandlerCollection handler = new ContextHandlerCollection();
		handler.addHandler(context);
		
		server.setHandler(handler);
		server.start();
		return server;
	}
}
